/*
 * @Description: 登记 - 移交相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 09:49:35
 * @LastEditTime: 2022-11-23 10:25:55
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRegTransferListParams {
  archiveTypeId?: number;
  archiveTypeName?: string;
  createTime?: string;
  createTimeList?: any[];
  dataSize?: number;
  diskNo?: string;
  efileCount?: number;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  fondsName?: string;
  fondsNo?: string;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  operatorTimeList?: any[];
  registrant?: string;
  registrationTime?: string;
  registrationTimeList?: any[];
  remark?: string;
  retentionPeriod?: string;
}

// 分页查询移交登记列表
export function fetchRegTransferListByPage(data: IPageQuery<IRegTransferListParams>) {
  return request({
    url: `/register-transfer/page`,
    method: 'post',
    data
  });
}

export interface IAddRegTransferParams {
  archiveTypeId?: number;
  detectionJobId?: number;
  detectionResult?: number;
  efileCount?: number;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  receiveBatchId?: number;
  receiveUnit?: string;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  transferDataSize?: number;
  transferMode?: number;
  transferTime?: string;
  transferUnit?: string;
  transferVectorType?: string;
  year?: string;
}

// 添加移交登记条目
export function addRegTransfer(data: IAddRegTransferParams) {
  return request({
    url: `/register-transfer/`,
    method: 'post',
    data
  });
}

export interface IEditRegTransferParams extends IAddRegTransferParams {
  id: number;
}
// 编辑移交登记条目
export function editRegTransfer(data: IEditRegTransferParams) {
  return request({
    url: `/register-transfer/`,
    method: 'put',
    data
  });
}

// 删除移交登记条目
export function deleteRegTransferItem(id: Key) {
  return request({
    url: `/register-transfer/${id}`,
    method: 'delete'
  });
}
